// List.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include "RemoveElement.h"
#include "DesignList.h"
#include "ReverseList.h"
#include "SwapPairs.h"
#include "RemoveNthFromEnd.h"

using namespace std;

int main()
{
	//RemoveElement
	cout << "RemoveElement:" << endl;
    List* head = InitList({ 1,2,6,3,4,5,6 });
	PrintList(head);

    List* result = RemoveElement(head, 6);
	PrintList(result);

    MyLinkedList myLinkedList;

    myLinkedList.addAtHead(2);
    myLinkedList.addAtTail(4);
    myLinkedList.addAtHead(-2);

    myLinkedList.addAtIndex(1, 1);
    myLinkedList.addAtIndex(3, 3);
    myLinkedList.addAtIndex(0, 0);

    myLinkedList.deleteAtIndex(0);

    cout << myLinkedList.get(0) << endl;;
	
	cout << "reserverResult:" << endl;
	PrintList(head);
	List* reserverResult = ReverseList(head);
	PrintList(reserverResult);

	List* head1 = InitList({ 1,2,6,3,4,5,6 });
	PrintList(head1);
	List* reserverResult1 = ReverseList(nullptr, head1);
	PrintList(reserverResult1);

	cout << "SwapPairs:" << endl;
	List* head2 = InitList({ 1,2,6,3,4,5,6,7 });
	PrintList(head2);
	List* swapPair = SwapPairs(head2);
	PrintList(swapPair);


	cout << "RemoveNthFromEnd:" << endl;
	List* head3 = InitList({ 1,2,6,3,4,5,6,7 });
	PrintList(head3);
	List* removeNthFromEnd = RemoveNthFromEnd(head3, 3);
	PrintList(removeNthFromEnd);
}

